package manager;

import dataAccess.IdTicketDB;
import exception.MyException;

public class IdTicketManager {
	
	public static IdTicketManager instance = null;
	
	private int lastId = 0;
	private int lastAnulationId = 0;

	private IdTicketManager() throws MyException{
		lastId = IdTicketDB.getMaxId();
		lastAnulationId = IdTicketDB.getMaxAnulationId();
	}
	
	public static IdTicketManager getInstance() throws MyException{
		if (instance == null)
			instance = new IdTicketManager();
		return instance;		
	}
	
	public int getLastId() {
		lastId++;
		return lastId;
	}
	
 	public int getLastAnulationId() {
		lastAnulationId++;
		return lastAnulationId;
	}
}
